//== GAIA ============================================================================

//== BEGINNING OF CODE ===============================================================

#include "sagittarius/core/SagittariusCore.h"

#include "sagittarius/unicode/CUnicode.h"
#include "sagittarius/re/reCS.h"

#include <stdio.h>
#include <string.h>
#include <malloc.h>

int main(int argc, char* argv[])
{
    RECS_Range AZ, r2, i1, az, ints;
	RE_CharSet *daset, *tmp;

	AZ = re_constructRange('A', 'Z');
    printf("AZ: ");
    re_writeRange(1, AZ);
    printf("\n");
    
    r2 = re_constructRange('U', 'a');
    printf("r2: ");
    re_writeRange(1, r2);
    printf("\n");
    
    re_intersectRanges(&i1, AZ, r2);
    printf("intersection: ");
    re_writeRange(1, i1);
    printf("\n");
    
    az = re_constructRange('a', 'z');
    printf("az: ");
    re_writeRange(1, az);
    printf("\n");
    
    daset = re_createCSEmpty();
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(AZ, daset);
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(az, daset);
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    tmp = daset;
    daset = re_uniteRangeSet(r2, daset);
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    //nums
    ints = re_constructRange('1', '9');
    tmp = daset;
    daset = re_uniteRangeSet(ints, daset);
    free(tmp);
    printf("daset: ");
    re_writeCS(1, daset);
    printf("\n");
    
    //sort
    re_CSSortInPlace(daset);
    printf("daset (sorted): ");
    re_writeCS(1, daset);
    printf("\n");
    
    free(daset);
    
    return 0;
}
